Project README — TTGO T-Display (ESP32) + TFT_eSPI
1) Device Used
Board: LILYGO / TTGO T-Display (ESP32)

Display: 1.14" ST7789, 240×135, SPI (on-board)

Libraries: TFT_eSPI, JPEGDecoder

2) Requirements
Arduino IDE (latest)

ESP32 Board Support:
Arduino IDE → Boards Manager → esp32 by Espressif (install)

Libraries:
Sketch → Include Library → Manage Libraries…
Install TFT_eSPI (by Bodmer) and JPEGDecoder (by Bodmer)

3) Quick Start (TTGO T-Display)
Select Board: Tools → Board → ESP32 Arduino → ESP32 Dev Module (ya “TTGO T-Display ESP32” agar dikhe)

Configure TFT_eSPI:

Open: Arduino/libraries/TFT_eSPI/User_Setup_Select.h

Enable TTGO T-Display setup (agar bundled ho). Agar nahi, to manual defines use karein:

cpp
Copy
Edit
// In User_Setup.h (or your custom setup)
#define ST7789_DRIVER
#define TFT_WIDTH  135
#define TFT_HEIGHT 240

#define TFT_MOSI 19
#define TFT_SCLK 18
#define TFT_CS    5
#define TFT_DC   16
#define TFT_RST  23
#define TFT_BL    4   // backlight (HIGH = on)

#define SPI_FREQUENCY  40000000
Backlight: Setup me TFT_BL defined ho to code me pinMode(4, OUTPUT); digitalWrite(4, HIGH); optional (kaafi setups auto-handle karte hain).

Upload: Aapka provided sketch compile karke upload karein.

Rotation: tft.setRotation(1); (landscape, 240×135). Values 0–3 valid.

Tips:

tft.setSwapBytes(true); keep ON if using 16-bit images (RGB565 arrays).

Images sized 240×135 best fit.

4) Alternate: Plain Arduino (UNO/Nano) + ST7789 SPI Breakout (Short Guide)
Recommended: 3.3V logic MCU (ESP32, Nano 33 IoT, etc.).
UNO/Nano (5V) use level shifter or resistor dividers for SCK/MOSI/DC/CS/RST.

Wiring (example, HW-SPI):

ST7789 Pin	Arduino UNO Pin
VCC	3.3V (not 5V)
GND	GND
SCL/SCK	D13
SDA/MOSI	D11
DC	D9
RST	D8
CS	D10
BL/LED	3.3V (ya PWM: D6 via 1k)

TFT_eSPI minimal defines (for UNO-style):

cpp
Copy
Edit
#define ST7789_DRIVER
#define TFT_WIDTH  240
#define TFT_HEIGHT 240   // many ST7789 breakouts default 240x240
// If your module is 240x135, set WIDTH/HEIGHT accordingly and use offsets
#define TFT_MOSI 11
#define TFT_SCLK 13
#define TFT_CS   10
#define TFT_DC    9
#define TFT_RST   8
// For 240x135 modules, also set:
// #define TFT_WIDTH  135
// #define TFT_HEIGHT 240
NOTE: Kaafi 240×135 ST7789 modules ko offsets chahiye hote hain; TFT_eSPI ke predefined setups me pick the closest “ST7789_135x240” config.

5) Common Gotchas (1-liners)
White screen: Wrong User_Setup or pins; backlight OFF; wrong driver.

Mirror/rotate issue: Try tft.setRotation(0..3).

Text cropped: Use word-wrap helper (jaise humne function add kiya) or reduce font/adjust margins.

Slow draw: Keep SPI_FREQUENCY high (e.g., 40MHz on ESP32), avoid per-pixel loops.